<template>
  <view class="setup">
    <!-- 头部 -->
    <pagehead @tap.stop="$tools.switchTab('/pagesMain/user/user')">设置</pagehead>
    <view class="content">
      <view class="item" v-for="(item, index) in arrownsList" :key="index" @tap.stop="$tools.jump(item.path)">
        <view class="left">
          <view class="img" :style="{ background: 'url(' + item.icon + ') 100% /cover no-repeat' }"></view>
          <text>{{ item.name }}</text>
        </view>
        <view class="right">
          <view class="arrows"></view>
        </view>
      </view>
    </view>
    <view class="submit" @tap.stop="logout">安全退出</view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      arrownsList: [
        { name: '个人信息', icon: this.$url.assetsPath + '/userimage/icon-about.png', path: '/pages/userInfo/usermsg' },
        { name: '实名', icon: this.$url.assetsPath + '/userimage/icon-editPass.png', path: '/pages/setup/editUserInfo' },
        { name: '修改登录密码', icon: this.$url.assetsPath + '/userimage/icon-editPass.png', path: '/pages/setup/editPass' },
        { name: '修改支付密码', icon: this.$url.assetsPath + '/userimage/icon-editPass.png', path: '/pages/setup/editPayass' },
        // { name: '微信免登录解绑', icon: this.$url.assetsPath + '/userimage/icon-unBind.png', path: '' },
        { name: '平台协议', icon: this.$url.assetsPath + '/userimage/icon-protocol.png', path: '/pages/setup/protocol' },
        // { name: '展示我的推荐人', icon: this.$url.assetsPath + '/userimage/icon-showInvite.png', path: '/pages/setup/about' },
        // { name: '关于我们', icon: this.$url.assetsPath + '/userimage/icon-about.png', path: '/pages/setup/about' },
      ],
    };
  },
  onLoad() {
    this.getUserInfo();
  },
  methods: {
    // 退出
    logout() {
      const that = this
      uni.showModal({
        title: '温馨提示',
        content: '你确定要安全退出？',
        success: function (res) {
          if (res.confirm) {
            console.log('用户点击确定');
            const data={}
            that.$Ajax('/api/user/login/userLogOut', data, res => {
              if (res.success) {
                // that.$tools.toastRedirectTo('退出登录成功', '/pagesMain/operate/login');
              }
            })
          } else if (res.cancel) {
            console.log('用户点击取消');
          }
        }
      });
      uni.removeStorageSync('token');
      uni.removeStorageSync('usermsg');
      uni.removeStorageSync('user');
      uni.removeStorageSync('address_id');
      uni.removeStorageSync('BALANCEOBJ');
      uni.removeStorageSync('qiniu_domain');
      uni.removeStorageSync('singUrl');
      setTimeout(() => {
      that.$tools.toastRedirectTo('退出登录成功', '/pages1/firtPage/firtPage');
      }, 1000)
    },
  },
};
</script>

<style lang="scss" scoped>
.setup {
  height: 100vh;
  background: #fff;

  .content {
    width: 93.6%;
    margin: auto;

    .item {
      @include flexBetween;
      padding-top: 28rpx;
      padding-bottom: 28rpx;
      border-bottom: 1px solid #eee;

      .left {
        @include flexLeft;
        font-weight: 600;
        font-size: 28rpx;
        color: #333333;
      }

      .img {
        width: 40rpx;
        height: 40rpx;
        margin-right: 20rpx;
      }

      .arrows {
        width: 32rpx;
        height: 32rpx;
        background: url($uni-static-dir+'/images/arrow-right.png') 100% no-repeat;
        background-size: 100% 100%;
      }
    }

    .item:last-of-type {
      border-bottom: none;
    }
  }

  .submit {
    width: 76.8%;
    text-align: center;
    height: 100rpx;
    line-height: 100rpx;
    background: #F3F4F9;
    border-radius: 242rpx;
    font-size: 36rpx;
    color: #333333;
    position: absolute;
    left: 11.6%;
    bottom: 100rpx;
  }
}
</style>
